<template>
  <FooterFields
    v-loading="headerLoading"
    :footerFields="headerFields"
    :fieldKeys="fieldKeys"
  />
</template>
<script>
import FooterFields from '@/pages/commodity/components/FooterFields';
import { getByRecordNoService } from '@/api/commodity/commodityAccessManage/commodityAdd';
export default {
  components: {
    FooterFields
  },
  data () {
    return {
      headerLoading: false,
      headerFields: {},
      fieldKeys: {
        pusherName: 'operName',
        pushTime: 'createOpeTime',
        pusherDeptName: 'operDeptName',
        pusherAreaName: 'operAreaName',
      }
    }
  },
  created () {
    this.updateHeaderInfo()
  },
  methods: {
    // 更新表头信息
    async updateHeaderInfo () {
      const data = { recordNo: this.$route.query?.recordNo }
      const loadingFn = state => { this.headerLoading = state }
      const res = await getByRecordNoService(data, loadingFn)
      this.headerFields = res?.retData ?? {}
    }
  }
}
</script>
